# Makefile for USB pickit tools:

OPTS=-O
OBJS=hex.o pic14.o usb_pickit.o

# Grab the version of libusb in /usr/local if possible:
LIBUSB=/usr/local
CFLAGS=$(OPTS) -I$(LIBUSB)/include
LDFLAGS=-L$(LIBUSB)/lib -lusb 

# Needed for static linking under OS X:
# LDFLAGS=-lusb -lIOKit -framework CoreFoundation

all: usb_pickit

usb_pickit: main.o $(OBJS)
	$(CC) $(CFLAGS) -o $@ main.o $(OBJS) $(LDFLAGS) 

suid-install: all
	chown root:root usb_pickit
	chmod u+s usb_pickit
	cp -p usb_pickit /usr/local/bin

install: 
	cp usb_pickit /usr/local/bin

clean:
	-rm usb_pickit *.o
